package com.itheima.jsoup;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.File;

public class Test01 {
    public static void main(String[] args) throws Exception {
        //获取student.xml的路径
        String path = Test01.class.getClassLoader().getResource("student.xml").getPath();
        //解析xml文档
        org.jsoup.nodes.Document document = Jsoup.parse(new File(path), "utf-8");
        //获取Element对象
        Elements elements = document.getElementsByTag("name");
        System.out.println(elements.size());
        //得到元素对象
        Element element = elements.get(0);
        String text = element.text();
        System.out.println(text);

    }
}
